<?php
/*
  $Id: product_info.php 1739 2007-12-20 00:52:16Z hpdl $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

  $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
  $product_check = tep_db_fetch_array($product_check_query);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
function popupWindow() {
	if(curid_img >0) {
  window.open("viewimg.php?id="+curid_img,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=600,height=400,screenX=150,screenY=150,top=150,left=150');
	}
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table width="897" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="72" background="images/3.jpg"><img src="images/3.jpg"/></td>
<!-- body_text //-->
    <td width="100%" valign="top">
	
	
	<?php
	$banner_img = "banner_pro2.jpg";
if (isset($cPath) && tep_not_null($cPath)) {
	$cate_pid =  substr($cPath,0,2);
	if($cate_pid == 58){
		$banner_img = "banner_parts.jpg";
	} elseif($cate_pid == 59){
		$banner_img = "banner_motors.jpg";
	} 
}
?>
	
	
	<table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td><?php include 'includes/header_nav.php';?></td>
      </tr>
      <tr>
            <td><img src="images/<?php echo $banner_img;?>" width="755" height="90" /></td>
          </tr>
      <tr>
        <td>
        
        
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="170" valign="top"><table border="0" cellspacing="0" cellpadding="0">
                  
                  <?php include(DIR_WS_BOXES . 'categories.php');?>
                  
                  <tr>
                    <td class="news_text"><div align="right"><img src="images/16.jpg" width="170" height="11" /></div></td>
                  </tr>
                  <tr>
                    <td height="25" valign="middle" bgcolor="#CFCBBF" class="style37"><img src="images/title_ft.jpg" width="165" height="16" /></td>
                  </tr>
                  <tr>
                    <td height="11" class="news_text"><img src="images/16.jpg" width="170" height="11" /></td>
                  </tr>
                  
                  
                  <?php include(DIR_WS_BOXES . 'specials.php');?>
                  
                  
                  
                  
                  
                  
                  <tr>
                    <td height="25" valign="middle" bgcolor="#CFCBBF" class="style37"><img src="images/title_tm.jpg" width="165" height="16" /></td>
                  </tr>
                  <tr>
                    <td bgcolor="#F4F4F4" style="font-size:12px;" >

<?php
$article_id = 20;
$article_query = tep_db_query("select ad.articles_name, ad.articles_description, ad.articles_url, ad.articles_head_desc_tag, a.articles_id, a.articles_date_added, a.articles_last_modified, date_format(a.articles_date_available, '%Y-%m-%d') as articles_date_available, a.articles_status, a.authors_id from " . TABLE_ARTICLES . " a, " . TABLE_ARTICLES_DESCRIPTION . " ad where a.articles_id = '" . (int)$article_id . "' and a.articles_id = ad.articles_id and ad.language_id = '" . (int)$languages_id . "'");
      $doc = tep_db_fetch_array($article_query);


echo $doc['articles_description'];

?>


</td>
                  </tr>
                </table>
                  </td>
                <td width="49" valign="top" background="images/18.jpg"><img src="images/17.jpg" width="49" height="15" /></td>
                <td valign="top">
                
                 <?php //include(DIR_WS_MODULES . 'product_listing.php'); ?>
               
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td height="15" bgcolor="#E0E0E0">
                    
                    <img src="images/arrows.gif" width="10" height="5" hspace="5" /><?php echo $breadcrumb->trail(' <img src="images/arrows.gif" width="10" height="5" hspace="5" /> '); ?>
                    </td>
                  </tr></table>
	
	
	
	
	
	<!---  start   -->
	<?php 
	$product_info_query = tep_db_query("select p.products_id,p.colors, pd.products_name,pd.products_summary,  pd.products_description, p.products_model, p.video_code, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
    $product_info = tep_db_fetch_array($product_info_query);

    tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

    if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
      $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
    } else {
      $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
    }

   // if (tep_not_null($product_info['products_model'])) {
      //$products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   // } else {
      $products_name = $product_info['products_name'];
   // }


    $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
    $reviews = tep_db_fetch_array($reviews_query);
	
	?>
	
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td width="310" valign="top"><table width="250" border="0" cellspacing="0">
                                <tr>
                                  <td align="center">

                                  <div style="width:300px;">
                                  <img src="<?php echo DIR_WS_IMAGES.$product_info['products_image'];?>" id="rawimg" width="230"  hspace="10" vspace="10" border="0" />
                                  </div>
                                  </td>
                                </tr>
                                <tr>
                                  <td height="55" valign="top">


<?php


$product_query = tep_db_query("select count(*) as total from products_img where products_id=".(int)$_GET['products_id']);
$tmpN = tep_db_fetch_array($product_query);
$imgN = $tmpN['total'];
if( $imgN > 0){


    ?>

                                  <table width="310" border="0" align="center" cellpadding="0" cellspacing="0">
                                      <tr>
                                        <td width="25"><A  href="javascript:void(0);" class="prev"><img src="images/arrow2.jpg" width="25" height="85" /></A></td>
                                        <td background="images/arrow3.jpg">
                                        <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                                            <tr>
                                              <td valign="top">

<script LANGUAGE="JavaScript" src="includes/jquery.js"></script>
<script LANGUAGE="JavaScript" src="includes/jcarousellite.min.js"></script>



<div class="anyClass">
    <ul>


<li><img style="margin:0 6px 0 4px;" src="<?php echo 'images/'.$product_info['products_image'];?>" width="50" class="imgthumb" onclick="showimg(this.src,0)" /></li>
<?php


$product_query = tep_db_query("select * from products_img where products_id=".(int)$_GET['products_id']);
while($d = tep_db_fetch_array($product_query)){

?>
   <li><img style="margin:0 6px 0 4px;" src="images/pm/s_<?php echo $d['products_image']?>" class="imgthumb" onclick="showimg(this.src,<?php echo $d['img_id']?>)" /></li>

<?php }?>
</ul>
</div>

                                              </td>

                                            </tr>
                                          </table></td>
                                        <td width="28"><A
href="javascript:void(0);" class="next"><img src="images/arrow1.jpg" width="28" height="85" /></A></td>
                                      </tr>
                                    </table>


                                    <?php
}
    ?>
	<?php if(!empty($product_info['video_code'])){ ?>
	<div style="font-size:12px;text-align:center;"><a target="_blank" href="http://www.youtube.com/watch?v=<?php echo $product_info['video_code']; ?>">Please click here to see the video.</a></div>
	<?php } ?>
	</td>
                                </tr>
                              </table>




</td>

                            <td valign="top"><table width="98%" border="0" cellspacing="0" cellpadding="7">
                                <tr>
                                  <td valign="top">



<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                          <tr>
                            <td><span class="style44"><span class="detail_product_name style16"><span class="style19"><?php echo $products_name; ?> </span></span><br />
Item #: <?php echo $product_info['products_model']; ?> <br />
<br />
<?php

$products_summary = $product_info['products_summary'];
echo nl2br($products_summary);

$colors = array();
$cc = 0;
if($product_info['colors']){
	
$colors = unserialize($product_info['colors']);
$cc =1;
	}
	$dircolor = "color/";
	
	
?>
                            </span></td>
                          </tr>
                        </table>
                        <?php if($cc){?>
                          <table width="98%" border="0"  cellpadding="0" cellspacing="0">
                            <tr>
                              <td height="35" class="style44">Color Available: </td>
                            </tr>
                            <tr>
                              <td><table border="0"  cellpadding="0" cellspacing="0">
                                <tr>
                                <?php foreach($colors as $img){?>
                                  <td><img src="<?php echo $dircolor.$img;?>" width="40" height="40" /></td>
                                  <?php }?>
                                </tr>

                              </table></td>
                            </tr>
                          </table>
                          <?php }?>

<div style="height:30px;"><span class="style44"><span class="style49"><span class="style51">MSRP:</span></span></span>
<span class="style44"><span class="style49"><strong><?php echo $products_price; ?></strong></span></span>

</div>
                                    <?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>
                                      
                                      
                                    
                                      

                                  
                                    
                                    <div>
                                      <?php
    $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
    $products_attributes = tep_db_fetch_array($products_attributes_query);
    if ($products_attributes['total'] > 0) {
?>
                                     
                                      <table border="0" cellspacing="0" cellpadding="2">
                                        <tr>
                                          <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
                                        </tr>
                                        <?php
      $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
      while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
        $products_options_array = array();
        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
        while ($products_options = tep_db_fetch_array($products_options_query)) {
          $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
          if ($products_options['options_values_price'] != '0') {
            $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
          }
        }

        if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
          $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
        } else {
          $selected_attribute = false;
        }
?>
                                        <tr>
                                          <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
                                          <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
                                        </tr>
                                        <?php
      }
	  echo '</table>';
	}
?>
                                      
                                    </div>


									<table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                              <td height="30" valign="middle"><span class="style44">Quantity:</span></td>
                              <td height="30" valign="middle"><span class="style44">
                                <input name="qty" type="text" value="1" size="3" maxlength="3" />
                              </span></td>
                            </tr>
                            
                          </table>


<div class="style48">
                                    <table><tr>
                                      <td><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.jpg', IMAGE_BUTTON_IN_CART); ?>
                                      </td></tr></table>
                                      </div>
									 

                                 </form>

                              </td>
                          </tr>
                        </table></td>
                      <td width="1" valign="top"><img src="images/5.jpg" width="1" height="258" /></td>
                    </tr>
                  </table>
	
		<table border="0" width="100%" align="center" cellpadding="0" cellspacing="0">
        <tr>
                    <td height="11" background="images/16.jpg"><span class="news_text"><img src="images/16.jpg" width="170" height="11" /></span></td>
                  </tr>
                  <tr>
                    <td height="20" bgcolor="#E0E0E0"><img src="images/arrows.gif" width="10" height="5" hspace="3" vspace="3" /><span class="style50">Product Description</span></td>
                  </tr>
                  <tr>
                    <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                      <tr>
                        <td><span class="style1"><?php echo stripslashes($product_info['products_description']); ?></span><br /></td>
                      </tr>
                    </table></td>
                  </tr></table>
	
	<!---  end   -->
    
    
    
    
	
	</td>
              </tr>
              
              
              
              
            </table>
            
            </td></tr>
            
            </table>
            
            </td>
<!-- body_text_eof //-->
    <td width="70" background="images/4.jpg"><img src="images/4.jpg" width="70" height="2" /></td>
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<script>
$(".imgthumb").css('cursor','pointer');
var curid_img = 0;
function showimg(str,id){
	curid_img = id;
$("#rawimg").attr('src',str.replace('s_','x_'));
}


$("#rawimg").click(function(){popupWindow()}).css('cursor','pointer');

<?php
if( $imgN > 0){

    ?>

$(function() {
    $(".anyClass").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev"
    });
});

<?php
}
    ?>
</script>
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
